simulate.month <- function(dt, theta, burnin, iterations) {
	curT <- dt$CONFLICT.t1 # initialize with observed values in previous time period
	sum <- numeric(length(dt$CONFLICT))
	sae <- numeric(iterations)
  	sse <- numeric(iterations)
  	for (i in 1:(burnin + iterations)) {
  	 	index <- order(runif(nrow(dt)))
    	for (j in index) {
     		etaT <- exp(theta[1] + theta[2]*dt$TOTPOP91[j] + theta[3]*dt$ELF91[j] + theta[4]*dt$BORDER[j] + theta[5]*dt$terrmean[j] + theta[6]*dt$CONFLICT.t1[j] + theta[7]*dt$CONFLICT.t2[j]+ theta[8]*(W%*%curT)[j] )
      		phatT <- etaT/(1+etaT)
      		curT[j] <- ifelse(runif(1) <= phatT, 1, 0)
    	}
    	if (i>burnin) {
    		sum <- sum + curT
    		sae[i-burnin] <- sum(abs(dt$CONFLICT-(sum/(i-burnin)))) 
    		sse[i-burnin] <- sum((dt$CONFLICT-(sum/(i-burnin)))^2) 
  		}
  	}
  	list(phats=sum/iterations, sae=sae, sse=sse)
} 

